import { StreamLoader } from "../core/StreamLoader";
import { ResourceInfo } from "../info/ResourceInfo";
import { ResByteManager } from "../ResByteManager";
//class BaseLoader
    
    export  class BaseLoader extends StreamLoader
    {
       

        public getClass(): Class
        {
            return BaseLoader;
        }

        public /* override */ load(arg1: string, arg2: ResourceInfo): void
        {
            var loc1=null;
            if (arg2) 
            {
                loc1 = arg2.cacheBytes;
                if (loc1) 
                {
                    _resourceInfo = arg2;
                    initialize(loc1);
                    return;
                }
            }
            super.load(arg1, arg2);
            return;
        }

        protected /* override */ streamloadComplete(arg1): void
        {
            if (_resourceInfo) 
            {
                _resourceInfo.cacheBytes = arg1;
            }
            return;
        }

        protected /* override */ onIOErrorHandler(arg1: Object /* flash.events.ErrorEvent */): void
        {
            if (_resourceInfo) 
            {
                _resourceInfo.isLoaded = false;
                _resourceInfo.isLoading = false;
            }
            super.onIOErrorHandler(arg1);
            return;
        }

        protected /* override */ onLoadCompleteHandler(): void
        {
            if (_resourceInfo) 
            {
                _resourceInfo.isLoaded = true;
                _resourceInfo.isLoading = false;
                _resourceInfo.isHasLoaded = true;
                _resourceInfo.resetDisposeTime();
                ResByteManager.addInfo(_resourceInfo);
            }
            super.onLoadCompleteHandler();
            return;
        }

        public /* var */data;
    }
